{% load text_filters %}
{% load static %}
{% load rooms %}

<div class="feed-topic-header" style="background-color: {{ room.color }};">
    <div class="feed-topic-header-title">
        <span class="room-icon feed-topic-header-icon"><img src="{{ room.image }}" alt="Иконка комнаты {{ room.title }}" loading="lazy" /></span>
        <a href="{% url "feed_room" room.slug %}" class="feed-topic-header-name">{{ room.title }}</a>
    </div>

    <span class="feed-topic-header-desctiption">
        {{ room.description | markdown }}
    </span>

    {% if room.url %}
        <span class="feed-topic-header-footer">
            <i class="fas fa-link"></i>&nbsp;<strong>URL:</strong> <a href="{{ room.url }}" rel="noreferrer" target="_blank">{{ room.url }}</a>
        </span>
    {% endif %}

    {% if room.chat_url and room.chat_name %}
        <span class="feed-topic-header-footer">
            <i class="fab fa-telegram-plane"></i>&nbsp;<strong>Чат:</strong> <a href="{{ room.get_private_url }}" rel="noreferrer" target="_blank">{{ room.chat_name }}</a>
            {% if room.chat_member_count %}<small>(~{{ room.chat_member_count }} человек)</small>{% endif %}
        </span>
    {% endif %}

    <div class="feed-topic-header-settings">
        <toggle
            url="{% url "toggle_room_subscription" room.slug %}"
            {% if room|is_room_subscribed:request.me %}is-active-by-default{% endif %}
            class="feed-topic-header-toggle"
        >
            подписка на комнату
        </toggle>

        <toggle
            url="{% url "toggle_room_mute" room.slug %}"
            {% if room|is_room_muted:request.me %}is-active-by-default{% endif %}
            class="feed-topic-header-toggle"
        >
            не показывать посты на главной
        </toggle>
    </div>
</div>
